home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / minix / update~4.z / update~4 / lib_stdio_putw.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-09-06  |  447 b   |  24 lines

  1. /*                p u t w
  2.  *
  3.  * Write a word to a stream. The function putw returns the word written
  4.  * or EOF on error. Because EOF is a valid word, it is better for the
  5.  * caller to check for errors using ferror.
  6.  *
  7.  * Patchlevel 1.0
  8.  *
  9.  * Edit History:
  10.  */
  11.  
  12. #include "stdiolib.h"
  13.  
  14. /*LINTLIBRARY*/
  15.  
  16. int putw(w, fp)
  17.  
  18. int w;                    /* word to write */
  19. FILE *fp;                /* stream */
  20.  
  21. {
  22.   return fwrite((void *) &w, (unsigned int)sizeof(int), 1, fp) == 1 ? w : EOF;
  23. }
  24.